package com.atguigu.cas;

import java.util.concurrent.atomic.AtomicInteger;

public class CasHello
{
    public static void main(String[] args)
    {
        AtomicInteger atomicInteger = new AtomicInteger(5);

        System.out.println(atomicInteger.get());

        System.out.println(atomicInteger.compareAndSet(5, 2025)+"\t"+atomicInteger.get());
        System.out.println(atomicInteger.compareAndSet(5, 1111)+"\t"+atomicInteger.get());


        System.out.println(atomicInteger.incrementAndGet());// ++i 2026

        System.out.println(atomicInteger.getAndIncrement()+"\t"+atomicInteger.get());// i++  ?

        System.out.println(atomicInteger.addAndGet(3));

    }
}
